03. C++ Versions

Versions of C++

The International Organization for Standardization publishes standards for the C++ language. Every few years the standard is updated with new features and syntax. The C++ standards are written documents providing guidelines for what the C++ language should be able to do and what the language looks like.

The responsibility for implementing a standard is left to the company, person or team that designs a compiler; hence, not all compilers implement all features. And some compilers might implement a feature differently.

There are currently five published C++ standards with the earliest standard called C++98 and the most recent standard C++17. The number designates the year in which the standard was published such as 1998 and 2017.

Thus far, the classroom has been compiling your code with the oldest standard: C++98. We have used C++98 so that you could get the basics of C++ down without worrying about advanced features.

As an example of a more advanced features, C++11, allows you to initialize a vector with the following syntax:

vector<int> myvector = {5, 4, 9, 1, 10}

There is generally a lag of a few years between publication of a standard and industry adoption.

GCC Compiler

The classroom uses a compiler called gcc. Thus far, we have been compiling your code for you when you hit the "Test Run" button. In the "Performance Programming C++" module, you will use a different interface for writing, compiling and running your code. This interface also uses the gcc compiler.

In the classroom, gcc compiles with C++98 by default. As you will see, you can use the command line to tell gcc what version of C++ to use:

g++ -std=c++11 main.cpp

You might find different behavior on your system because of the compiler you are using or because of your compiler options.

C++ Versions

QUIZ QUESTION::

Rank the C++ standards from oldest to newest

ANSWER CHOICES:



Order

C++ Version

C++03

C++17

C++98

C++14

C++11

SOLUTION:

Order

C++ Version

C++03

C++17

C++98

C++14

C++11